# Contributor: Michael Jeanson <mjeanson@efficios.com>
# Maintainer: Michael Jeanson <mjeanson@efficios.com>
pkgname=lttng-ust
pkgver=2.12.0
pkgrel=2
pkgdesc="LTTng 2.0 Userspace Tracer"
url="https://lttng.org"
arch="all"
license="LGPL-2.1-or-later"
makedepends="userspace-rcu-dev>0.10 util-linux-dev linux-headers python3"
checkdepends="bash"
subpackages="$pkgname-doc $pkgname-dev $pkgname-tools::noarch py3-lttng:pyagent"
source="https://lttng.org/files/lttng-ust/lttng-ust-$pkgver.tar.bz2"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--disable-numa \
		--enable-python-agent
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	sed -i 's|^#!/usr/bin/env python$|#!/usr/bin/env python3|' "$pkgdir"/usr/bin/lttng-gen-tp
}

tools() {
	pkgdesc="tools from lttng-ust"
	depends="lttng-ust=$pkgver-r$pkgrel python3"

	amove usr/bin
}

pyagent() {
	pkgdesc="lttng-ust python agent"
	depends="python3"

	amove /usr/lib/python*
	amove /usr/lib/liblttng-ust-python-agent.*
}

sha512sums="d69772170f57b9669b99cea372ca537777151a31b82002e1e5ec80da3ceb302c23f0f85d63a2c95c90a375b879e266aa5297e7d6444050dd40feb1253d863801  lttng-ust-2.12.0.tar.bz2"
